-
Notifications
You must be signed in to change notification settings - Fork 620
chore: redirect /team to /team/~ to select a team #7124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: redirect /team to /team/~ to select a team #7124
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
WalkthroughThe changes update the logic for retrieving a user's last visited team by renaming and modifying the function to return Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TeamPage
participant API
User->>TeamPage: Access team root page
TeamPage->>API: getLastVisitedTeam()
alt Team found
TeamPage->>User: Redirect to /team/{team.slug}
else No team found
TeamPage->>User: Redirect to /team/~
end
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (3)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7124 +/- ##
=======================================
Coverage 55.58% 55.58%
=======================================
Files 902 902
Lines 58162 58162
Branches 4086 4086
=======================================
Hits 32329 32329
Misses 25731 25731
Partials 102 102
🚀 New features to boost your workflow:
|
|
|
||
| export default async function TeamRootPage() { | ||
| const team = await getLastVisitedTeamOrDefaultTeam(); | ||
| if (!team) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously this would redirect to the notFound page if the token was invalid. Now it redirects to /team/~ to handle it there.
Basically I think /team should always redirect to another team page, and let those pages handle the logged out or invalid auth cases.
size-limit report 📦
|
| if (res.ok) { | ||
| return (await res.json())?.result as Team; | ||
| } | ||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Re: line +70]
separately we just also need to remove this anywhere it is being used
See this comment inline on Graphite.
Merge activity
|
## [Dashboard] Fix: Simplify team redirection logic
## Notes for the reviewer
This PR modifies the team redirection logic by:
1. Renaming `getLastVisitedTeamOrDefaultTeam()` to `getLastVisitedTeam()`
2. Removing the fallback to `getDefaultTeam()` when no last visited team is found
3. Updating the team root page to redirect to `/team/~` when no team is found instead of showing a 404
## How to test
Verify that users are properly redirected to their last visited team when available, and to `/team/~` when no team history exists.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **Bug Fixes**
- Improved handling when no last visited team is found by redirecting users to a fallback page instead of showing a not found error.
- **Refactor**
- Updated team selection logic to remove fallback to a default team and streamline user redirection.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR refactors the `getLastVisitedTeamOrDefaultTeam` function to `getLastVisitedTeam`, changing its behavior to return `null` instead of a default team. It updates the `TeamRootPage` to handle the absence of a team by redirecting to a fallback URL.
### Detailed summary
- Renamed function `getLastVisitedTeamOrDefaultTeam` to `getLastVisitedTeam`.
- Changed return value of `getLastVisitedTeam` from `getDefaultTeam()` to `null`.
- Updated `TeamRootPage` to redirect to `/team/~` if no team is found, instead of calling `notFound()`.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
0a727d1 to
c1f7aaa
Compare

[Dashboard] Fix: Simplify team redirection logic
Notes for the reviewer
This PR modifies the team redirection logic by:
getLastVisitedTeamOrDefaultTeam()togetLastVisitedTeam()getDefaultTeam()when no last visited team is found/team/~when no team is found instead of showing a 404How to test
Verify that users are properly redirected to their last visited team when available, and to
/team/~when no team history exists.Summary by CodeRabbit
Bug Fixes
Refactor
PR-Codex overview
This PR refactors the team retrieval logic in the dashboard application. It renames the
getLastVisitedTeamOrDefaultTeamfunction togetLastVisitedTeamand modifies its behavior. TheTeamRootPagecomponent is updated to handle the new function and its return value.Detailed summary
getLastVisitedTeamOrDefaultTeamtogetLastVisitedTeam.getLastVisitedTeamfromgetDefaultTeam()tonull.TeamRootPageto callgetLastVisitedTeaminstead.teamisnull, redirecting to/team/~.